/// \file utils.h.
///============================================================================\n
/// Name        : utils.h\n
/// Author      : Gergely Lukacsy (info@dlog-reasoner.org)\n
/// Version     : 0.01\n
/// Copyright   : DERI\n
/// Description : Auxiliary classes, typedefs, etc., header file.\n
/// 
/// This file is part of the DParser and DLog 2 projects.\n
///============================================================================

#ifndef UTILS_H_
#define UTILS_H_

/// Struct used to represent strings together their lengths.
struct STRINGN {
	/// Constructor.
	explicit STRINGN(char* pStringToAdd, INT length);
	
	/// The internal string.
	char* pString;

	/// The effective length of the internal string.
	INT nLength;
};


/// Struct representing either an integral value or a string.
struct NUMBERORSTRING {
	/// Non-explicit Constructor for integral values.
	NUMBERORSTRING(INT n) { nValue = n; }

	/// Non-Explicit Constructor for strings.
	NUMBERORSTRING(char* pC) { pString = pC; }

	union {
		/// Value as an integer.
		INT nValue;

		/// Value as a string.
		char* pString;
	};
};

/// Identifies an atomic entity by a pair of strings (prefix and localname).
struct ATOMICIDENTIFIER {
	/// Prefix of the entity.
	const char* pPrefix;

	/// Local name of the entity.
	const char* pLocalName;
};


#endif /* UTILS_H_ */
